#include <stdio.h>

#define MAX_TEAMS   128

static double p[MAX_TEAMS][MAX_TEAMS];  /* p[i][j] = prob(i wins j) */
static double q[MAX_TEAMS]; /* q[i] = prob(i remains after this round) */

static int solve()
{
    int num_rounds, num_teams, i, j, r, winner;

    scanf("%d", &num_rounds);
    if (num_rounds <= 0)
        return 0;

    /* Read winning probabilities p[i][j]. */
    num_teams = 1 << num_rounds;
    for (i = 0; i < num_teams; i++)
        for (j = 0; j < num_teams; j++)
            scanf("%lf", &p[i][j]);

    /* Initialize the 'remaining' probability of each team to 1. */
    for (i = 0; i < num_teams; i++)
        q[i] = 1.0;

    /* For each round, update the 'remaining' probability of each team. */
    for (r = 0; r < num_rounds; r++)
    {
        double qq[MAX_TEAMS];
        for (i = 0; i < num_teams; i++)
        {
            int zone = ((1 << r) ^ i) & ~((1 << r) - 1);
            qq[i] = 0.0;
            for (j = zone + 0; j < zone + (1 << r); j++)
                qq[i] += p[i][j] * q[j];
        }
        for (i = 0; i < num_teams; i++)
            q[i] *= qq[i];
    }

    winner = 0;
    for (i = 1; i < num_teams; i++)
        if (q[i] > q[winner])
            winner = i;

    printf("%d\n", winner + 1);
    return 1;
}

int main()
{
    while (solve());
    return 0;
}
